代码拉取完成,页面将自动刷新
package xsd
import (
"net/url"
"os"
"path/filepath"
"github.com/lestrrat-go/libxml2/internal/option"
)
// WithPath provides a hint to the XSD parser as to where the
// document being parsed is located at.
//
// This is useful when you must resolve relative paths inside a
// document, because to use relative paths the parser needs to
// know the reference location (i.e. location of the document
// being parsed). In case where you are parsing using `ParseFromFile()`
// this is handled automatically by the `ParseFromFile` method,
// but if you are using `Parse` method this is required
//
// If the path is provided as a relative path, the current directory
// should be obtainable via `os.Getwd` when this call is made, otherwise
// path resolution may fail in weird ways.
func WithPath(path string) Option {
if !filepath.IsAbs(path) {
if curdir, err := os.Getwd(); err == nil {
path = filepath.Join(curdir, path)
}
}
return WithURI(
(&url.URL{
Scheme: `file`,
Path: path,
}).String(),
)
}
func WithURI(v string) Option {
return option.New(option.OptKeyWithURI, v)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。